//
//  PZLTableViewCell.m
//  Various
//
//  Created by dllo on 16/3/25.
//  Copyright © 2016年 Harword. All rights reserved.
//

#import "PZLTableViewCell.h"

@implementation PZLTableViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}

- (void)creatCell{
    
  
    
    self.imageViewPic = [[UIImageView alloc] initWithFrame:CGRectMake(3*sWEIGHT, 2*sHEIGHT, sWEIGHT*414 - 6*sWEIGHT, 225*sHEIGHT)];
    [self.imageViewPic setTintColor:[UIColor blackColor]];
    [self.contentView addSubview:self.imageViewPic];
    
    // 添加一层view把图片变暗
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, sWEIGHT*414 - sWEIGHT*6, 225*sHEIGHT)];
    view.backgroundColor = [UIColor blackColor];
    view.alpha = 0.3;
    [self.imageViewPic addSubview:view];
    
    
    
    
    
    self.labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(70*sWEIGHT, 90*sHEIGHT, sWEIGHT*414 - 140*sWEIGHT, 30*sHEIGHT)];
    self.labelTitle.textAlignment = NSTextAlignmentCenter;
    self.labelTitle.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:17*sWEIGHT];
    [self.contentView addSubview:self.labelTitle];
    
    
    self.labelContent = [[UILabel alloc] initWithFrame:CGRectMake(120*sWEIGHT, 120*sHEIGHT, sWEIGHT*414 - 240*sWEIGHT, 20*sHEIGHT)];
    self.labelContent.textAlignment = NSTextAlignmentCenter;
    self.labelContent.font = [UIFont fontWithName:@"Arial" size:12*sWEIGHT];
    [self.contentView addSubview:self.labelContent];
    
    
}


- (void)setModel:(PZLItemsModel *)model{
    _model = model;
        
        [self.imageViewPic sd_setImageWithURL:[NSURL URLWithString:[model.pic objectForKey:@"url"]] placeholderImage:nil];
        self.labelTitle.text = model.title;
        self.labelTitle.textColor = [UIColor whiteColor];
        self.labelContent.text = model.content;
        self.labelContent.textColor = [UIColor whiteColor];
    
}









@end
